//ripped from http://amix.dk/blog/viewEntry/161  -  RND - fast and simple JS template system 
function RND(tmpl, ns) 
{
	var fn = function(w, g) 
	{
		g = g.split("|");
		var cnt = ns[g[0]];
		for(var i=1; i < g.length; i++)
		{
			cnt = eval(g[i])(cnt);
		}
		return cnt || w;
	};
	return tmpl.replace(/%\(([A-Za-z0-9_|.]*)\)/g, fn);
}